package controller

import (
	"github.com/kataras/iris/v12/sessions"
	"iristest/common/middleware"
	"iristest/controller/loginController"
	"iristest/controller/userInfoController"

	"github.com/kataras/iris/v12/mvc"
)

var (
	cookieNameForSessionID = "heiy202209191548"
	sess                   = sessions.New(sessions.Config{Cookie: cookieNameForSessionID})
)

func ApiMvc(app *mvc.Application) {
	app.Router.Use(middleware.Cors, sess.Handler(), middleware.JwtVerify)
	app.Handle(loginController.New())
	app.Party("/user").Handle(userInfoController.New())
}

func ViewMvc(app *mvc.Application) {
	app.Router.Use(sess.Handler(), middleware.JwtVerify)
}
